package com.ey12.utils;

import java.util.Date;

public class DateUtil {
	
//	public static void main(String[] a){
//		System.out.println(new DateUtil().toTimeString());
//	}
	
	public static String formatDate(String param) {
		String result="";
		if(param.indexOf("-")!=-1){
			String[] items=param.split("-");
			result=result+items[0];
			if(items[1]!=null){
				if(items[1].length()==1){
					result=result+"-0"+items[1];
				}
				else{
					result=result+"-"+items[1];
				}
			}
			if(items[2]!=null){
				if(items[2].length()==1){
					result=result+"-0"+items[2];
				}
				else{
					result=result+"-"+items[2];
				}
			}
		}

		return result;
	}
	
	
	public String toDateString() {
		Date d = new Date();
		String s;
		/** ����ʽ: 2006-01-01*/
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(
				"yyyy-MM-dd");
		s = format1.format(new Date());

		return s;
	}
	public String toPayMoneyNum() {
		Date d = new Date();
		String s;

		/** ����ʽ: 2006-01-01 00:00:00 */
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(
				"yyyyMMddHHmmss");
		s ="P"+ format1.format(new Date());
		return s;

	}
	public String toGetMoneyNum() {
		Date d = new Date();
		String s;

		/** ����ʽ: 2006-01-01 00:00:00 */
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(
				"yyyyMMddHHmmss");
		s ="G"+ format1.format(new Date());
		return s;

	}
	public String toGetOrderNum() {
		Date d = new Date();
		String s;

		/** ����ʽ: 2006-01-01 00:00:00 */
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(
				"yyyyMMddHHmmss");
		s ="OS"+ format1.format(new Date());
		return s;

	}
	public String toTimeString() {
		Date d = new Date();
		String s;

		/** ����ʽ: 2006-01-01 00:00:00 */
		java.text.DateFormat format1 = new java.text.SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		s = format1.format(new Date());
		return s;

	}

}